Component({
  properties: {
    // 这里定义了innerText属性，属性值可以在组件使用时指定
    selectIndex: {
      type: Number,
      value: 0
    }
  },
  data: {
    // 这里是一些组件内部数据
    dataList: [{
      id: 0,
      name: '首页',
      imgUrl: 'https://img.qumoyugo.com/webimgbg/image-tabbar-home.png',
      selectedImgUrl: 'https://img.qumoyugo.com/webimgbg/image-tabbar-home-a.png',
      pagePath: '/pages/index'
    },
    {
      id: 1,
      name: '活动',
      imgUrl: 'https://img.qumoyugo.com/webimgbg/image-tabbar-activity.png',
      selectedImgUrl: 'https://img.qumoyugo.com/webimgbg/image-tabbar-activity-a.png',
      pagePath: '/pages/eventsList'
    },
    {
      id: 2,
      name: '活动圈',
      imgUrl: 'https://img.qumoyugo.com/webimgbg/image-tabbar-activity.png',
      selectedImgUrl: 'https://img.qumoyugo.com/webimgbg/image-tabbar-activity-a.png',
      pagePath: '/pages/pamperedCircle'
    },
    {
      id: 3,
      name: '绿皮书',
      imgUrl: 'https://img.qumoyugo.com/webimgbg/image-tabbar-activity.png',
      selectedImgUrl: 'https://img.qumoyugo.com/webimgbg/image-tabbar-activity-a.png',
      pagePath: '/pages/hotel'
    },
    {
      id: 4,
      name: '我的',
      imgUrl: 'https://img.qumoyugo.com/webimgbg/image-tabbar-user.png',
      selectedImgUrl: 'https://img.qumoyugo.com/webimgbg/image-tabbar-user-a.png',
      pagePath: '/pages/personal'
    }
    ],
    heightBar: 58
  },
  attached() {
    const { screenHeight, safeArea} = wx.getSystemInfoSync()
    const _h = screenHeight - safeArea.bottom
    this.setData({
      heightBar: _h ? 58 + _h : 72
    })
  },
  methods: {
    // 这里是一个自定义方法
    onClick (item) {
      wx.switchTab({
        url: item.currentTarget.dataset.id
      })
    }
  }
})
